<html>

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <link href="../../build/common/base.css" rel="stylesheet">
  <link rel="stylesheet" href="../../build/form/page.css">
  <script type="text/javascript" src="../../build/common/base.js"></script>
  <script type="text/javascript" src="../../build/common/vueEdit.js"></script>
  <script src="../../assets/js/common/element/index.js"></script>
  <style>
    * {
      padding: 0px;
      margin: 0px;
    }

    ul li {
      list-style: none;
    }

    .my_cols {
      margin: 20px 0;
    }

    .ctrlC thead th {
      text-align: center;
    }
  </style>
</head>

<body>
  <div id="ctrlC" style="padding: 30px;">
    <!-- <div class="consea">隐藏相同项</div> -->

    <span @click="handCol()" class="btn btn-success mb30 mr15">返回</span>
    <span @click="handSub()" class="btn btn-success mb30">提交</span>
    <table style="margin-top: 20px;" class="table table-striped table-bordered table_hover text-center mb60">
      <thead>
        <tr>
          <th>选择</th>
          <th>名字</th>
          <th>一级目录</th>
          <th>二级目录</th>
          <th>三级目录</th>
          <th>四级目录</th>

        </tr>
      </thead>
      <tbody>
        <tr v-for="(item,index) in level">
          <td><input type="checkbox" name="vehicle" value="Car" v-model="item.Checked"
              @change="updateIds($event,item.materialcoding,item.productName)" /></td>
          <td>{{item.productName}}</td>
          <td>{{item.firstdirectory}}</td>
          <td>{{item.twodirectory}}</td>
          <td>{{item.threedirectory}}</td>
          <td>{{item.fourdirectory}}</td>

        </tr>
      </tbody>
    </table>


  </div>
</body>
<div id="ceshi"></div>
<script type="text/javascript">


  var vm = new Vue({
    el: "#ctrlC",
    data: function () {
      return {
        materialcoding: [],
        checkedValue: "",
        selectIds: [],
        productName: [],
        level: [

        ]
        // level: {
        //   three: "低级",
        //   two: "中级",
        //   one: "高级"
        // }
      }
    },
    beforeCreate: function () {
    },
    created: function () {
      console.log("==", sessionStorage.getItem("arrstr").split(",")[0])
      var that = this
      var url = Vue.__ctx + "/sys/AclStandardPrice/findlist/" + sessionStorage.getItem("arrstr").split(",")[0];
      var post = Vue.baseService.get(url);
      post.then(function (res) {
        that.level = res
        console.log("wwww", res)
      }, function (status) {
        if (status == !0) {
          $.Toast.error('加载失败！' + status);
        }
      })
    },
    methods: {
      updateIds: function ($event, CardNo, productName) {
        // console.log($event.target.checked, CardNo);
        if ($event.target.checked) {
          this.selectIds.push(CardNo);
          this.productName.push(productName);
        } else {
          var idx1 = this.selectIds.indexOf(CardNo);
          var idx2 = this.productName.indexOf(productName);
          this.selectIds.splice(idx1, 1);
          this.productName.splice(idx2, 1);
        }
        console.log("www", this.selectIds, this.productName)
      },
      handRow: function (wlbm) {
        console.log("wwww", vals)
      },
      handCol: function () {

        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
        parent.location.reload();//刷新父页面，注意一定要在关闭当前iframe层之前执行刷新
        parent.layer.close(index);
      },
      handSub: function () {

        var that = this
        var ids = this.selectIds.join(",") + ","
        var names = this.productName.join(",") + ","
        var id = sessionStorage.getItem("arrstr")
        var name = sessionStorage.getItem("arrcpmcstr")
        sessionStorage.setItem("xuanzhongid", ids)
        sessionStorage.setItem("xuanzhongname", names)
        var url = Vue.__ctx + "/sys/paramCompare/compareParams/" + id + "&" + ids + "/" + name + "&" + names;
        var post = Vue.baseService.get(url);
        post.then(function (res) {
          // me.add(url)
          window.parent.add()
          var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
          // parent.location.reload();//刷新父页面，注意一定要在关闭当前iframe层之前执行刷新
          parent.layer.close(index);
          // window.parent.add()


        }, function (status) {
          if (status == !0) {
            $.Toast.error('加载失败！' + status);
          }
        })
      }

    },

    watch: {

    }
  });
</script>

</html>